#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
typedef struct TreeNode
{
	int data;
	struct TreeNode *left;
	struct TreeNode* right;
}TreeNode;

int MaxDepth(TreeNode* root)
{
	if (root == NULL)
	{
		return 0;
	}
	return  MaxDepth(root->right) > MaxDepth(root->left) ? MaxDepth(root->right) + 1 : MaxDepth(root->left) + 1;
}
int main()
{
	TreeNode n1;
	TreeNode n2;
	TreeNode n3;
	TreeNode n4;
	TreeNode n5;
	n1.left = &n2;
	n1.right = &n3;
	n3.left = NULL;
	n3.right = NULL;
	n2.right = NULL;
	n2.left = &n4;
	n2.right = NULL;
	n4.left = &n5;
	n4.right = NULL;
	n5.left = NULL;
	n5.right = NULL;
	n1.data = 1;
	n2.data = 2;
	n3.data = 3;
	n4.data = 4;
	n5.data = 5;
	printf("%d", MaxDepth(&n1));
	return 0;
}